/// 本模块会说明变量的相关特性
pub fn main(){

    // 声明一个变量
    let name  = String::new();

    // 声明一个可变的变量
    let mut name  = String::new();
    name.push_str("aa");

    mut_re(&mut name);
    println!("{}", name);

    // let banme = (100, CONTINUE, "Continue");
   
}

fn mut_re(s :&mut String){
    s.push_str("b");
}

#[cfg(test)]
mod test {
    use std::cell::Cell;

    struct User {
        age: u8,
    }


    #[test]
    /// 这是个可变引用的测试
    fn mutable_test() {
        let mut s = String::from("hello");
        immutable_test1(&mut s);
        immutable_test1(&mut s);
        immutable_test1(&mut s);
        println!("{}", s);

        let c1 = Cell::new(User{age:8});
        c1.set(User{age:9});
      
    }

    fn immutable_test1(s: &mut String) {
        s.push_str("s");
    }

    #[test]
    fn test1() {
        let s = "3";
        // println!("{:p}", 3);
        println!("{:p}", s);
        println!("{:p}", &s);
        println!("{:p}", &&s);
    }
}